home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / pmake / script.mk < prev    next >
Encoding:
Text File  |  1991-09-25  |  3.6 KB  |  152 lines

  1. #
  2. # Included makefile for managing a directory containing only a shell script.
  3. #
  4. # $Header: /sprite/lib/pmake/RCS/script.mk,v 1.20 91/09/24 19:03:42 jhh Exp $ SPRITE (Berkeley)
  5. #
  6. # The makefile that includes this one should already have defined the
  7. # following variables:
  8. #    NAME        the shell script.
  9. #       MACHINES    list of all target machines currently available
  10. #            for this program.
  11. #    TYPE        a keyword identifying which sort of command this
  12. #            is;  used to determine where to install, etc.
  13. #
  14. # Optional variables that may be defined by the invoker:
  15. #    INSTALLFLAGS    additional flags to pass to install script.
  16. #
  17.  
  18. #
  19. # System programs -- assign conditionally so they may be redefined in
  20. # the including makefile
  21. #
  22. BINDIR        = /sprite/cmds.$(MACHINE)
  23.  
  24. RM        ?= $(BINDIR)/rm
  25. TEST            ?= $(BINDIR)/test
  26. UPDATE        ?= $(BINDIR)/update
  27.  
  28. #
  29. # Several variables (such as where to install) are set based on the
  30. # TYPE variable.  Of course, any of these variables can be overridden
  31. # by explicit assignments.
  32. #
  33. TYPE        ?= unknown
  34. #if !empty(TYPE:Msprite)
  35. INSTALLDIR    ?= /sprite/cmds
  36. INSTALLMAN    ?= /sprite/man/cmds
  37. #elif !empty(TYPE:Mx)
  38. INSTALLDIR    ?= /X/cmds
  39. INSTALLMAN    ?= /X/man/cmds
  40. #elif !empty(TYPE:MX11R3)
  41. INSTALLDIR    ?= /mic/X11R3/cmds
  42. INSTALLMAN    ?= /mic/X11R3/man/cmds
  43. #elif !empty(TYPE:MX11R4)
  44. INSTALLDIR    ?= /X11/R4/cmds
  45. INSTALLMAN    ?= /X11/R4/man/cmds
  46. #elif !empty(TYPE:Mdaemon)
  47. INSTALLDIR    ?= /sprite/daemons
  48. INSTALLMAN    ?= /sprite/man/daemons
  49. #elif !empty(TYPE:Madmin)
  50. INSTALLDIR    ?= /sprite/admin
  51. INSTALLMAN    ?= /sprite/man/admin
  52. #elif !empty(TYPE:Mpersonal)
  53. INSTALLDIR    ?= $(HOME)/cmds
  54. INSTALLMAN    ?= $(HOME)/man/cmds
  55. #elif !empty(TYPE:Mlocal)
  56. INSTALLDIR    ?= /local/cmds
  57. INSTALLMAN    ?= /local/man/cmds
  58. #ifndef        USERBACKUP
  59. NOBACKUP    =
  60. #endif
  61. #endif
  62. #ifdef INSTALLDIR
  63. TMINSTALLDIR    ?= $(INSTALLDIR).$(TM)
  64. #endif
  65.  
  66. #
  67. # Figure out what stuff we'll pass to sub-makes.
  68. #
  69. PASSVARS    = 'INSTALLDIR=$(INSTALLDIR)' $(.MAKEFLAGS)
  70.  
  71. #
  72. # Set up flags for various utility programs.
  73. #
  74.  
  75. #include    <tm.mk>
  76. INSTALLFLAGS    ?=
  77. INSTALLMANFLAGS    ?=
  78.  
  79. #
  80. # MAKEINSTALL usage:
  81. #    <target> : MAKEINSTALL
  82. # All of the shell scripts get updated to INSTALLDIR.
  83. #
  84. MAKEINSTALL    : .USE .SILENT
  85. #if !empty(NAME)
  86.     $(UPDATE) -l -m 555 $(INSTALLFLAGS) $(NAME) $(TMINSTALLDIR)/$(NAME)
  87. #endif
  88.  
  89. #ifndef no_targets
  90.  
  91. default            :: $(NAME)
  92.  
  93. clean tidy cleanall    ::
  94.     $(RM) -f *~
  95.  
  96. #
  97. # For "install", a couple of tricks.  First, allow local.mk to disable
  98. # by setting no_install.  Second, use :: instead of : so that local.mk
  99. # can augment install with additional stuff.  Third, issue a warning
  100. # message if TMINSTALLDIR hasn't been defined.
  101. #
  102. #ifndef no_install
  103. #ifdef TMINSTALLDIR
  104. install         :: installman MAKEINSTALL
  105. #else
  106. install            :: .SILENT
  107.     echo "Can't install $(NAME):  no install directory defined"
  108. #endif TMINSTALLDIR
  109. #endif no_install
  110.  
  111. #if empty(MANPAGES)
  112. installman        :: .SILENT
  113.     echo "There's no man page for $(NAME).  Please write one."
  114. #elif !empty(MANPAGES:MNONE)
  115. installman        ::
  116. #elif defined(INSTALLMAN)
  117. installman        :: .SILENT
  118.     $(UPDATE) -m 444 -l $(INSTALLMANFLAGS) $(MANPAGES) $(INSTALLMAN)
  119. #else
  120. installman        :: .SILENT
  121.     echo "Can't install man page(s): no install directory defined"
  122. #endif
  123.  
  124. mkmf newtm        ! .SILENT
  125.     mkmf
  126.  
  127. #
  128. # Most targets get ignored completely for scripts, since there's
  129. # nothing to do.
  130. #
  131.  
  132. depend lint tags    :: # says nothing, does nothing
  133.  
  134. dist        !
  135. #if defined(DISTDIR) && !empty(DISTDIR)
  136.     for i in Makefile local.mk $(TM).md/md.mk $(MANPAGES) $(NAME)
  137.     do
  138.     if $(TEST) -e $${i}; then
  139.         $(UPDATE)  $${i} $(DISTDIR)/$${i} ; else true; fi
  140.     done
  141. #else
  142.     @echo "Sorry, no distribution directory defined."
  143. #endif
  144.  
  145. #include        <all.mk>
  146.  
  147. #endif no_targets
  148.  
  149. .MAKEFLAGS    : -C        # No compatibility needed
  150.  
  151. #include        <rdist.mk>
  152.